//
//  GDSqliteDataViewController.m
//  Gunterapple
//
//  Created by 热带雨林 on 2021/1/30.
//  Copyright © 2021 热带雨林. All rights reserved.
//

#import "GDSqliteDataViewController.h"
#import "openOrCloseModel.h"
static NSString *cellID = @"cellID";
@interface GDSqliteDataViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@end

@implementation GDSqliteDataViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置背景色为半透明
    self.view.backgroundColor = [[UIColor clearColor]colorWithAlphaComponent:0.5];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(click)];
    [self.view addGestureRecognizer:tap];
    
    [self.view addSubview:self.tableView];
    self.tableView.layer.cornerRadius = 10.0f;
    self.tableView.layer.masksToBounds = YES;
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(GDScreenW - 30, GDScreenW - 30));
    }];
    [self.tableView reloadData];
}
- (void)click{
    [self dismissViewControllerAnimated:NO completion:^{
        
    }];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    openOrCloseModel *model = self.dataArray[indexPath.row];
    cell.textLabel.text = [NSString stringWithFormat:@"ID:%@   tipStr:%@   descStr:%@",model.ID,model.tipStr,model.descStr];
    return cell;
}
- (UITableView *)tableView{
    if(!_tableView){
        _tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
        _tableView.dataSource = self;
        _tableView.delegate = self;
        _tableView.showsVerticalScrollIndicator = NO;
    }
    return _tableView;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
